{extend name='main'}

{block name="button"}

{if auth("add_cs")}
<button data-modal='{:url("add_cs")}' data-title="添加客服" class='layui-btn'>添加客服</button>
{/if}

{/block}

{block name="content"}

<div class="think-box-shadow">
    {include file='users/cs_search'}
    <table class="layui-table margin-top-15" lay-filter="tab" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th lay-data="{field:'id',width:80}" class='text-left nowrap'>ID</th>
            <th lay-data="{field:'username',width:200}" class='text-left nowrap'>用户名</th>
            <!--<th lay-data="{field:'tel'}" class='text-left nowrap'>手机号</th>
            <th lay-data="{field:'qq'}" class='text-left nowrap'>QQ</th>-->
            <th lay-data="{field:'url'}" class='text-left nowrap'>链接</th>
            <!--<th lay-data="{field:'wechat'}" class='text-left nowrap'>微信</th>
            <th lay-data="{field:'qr_code'}" class='text-left nowrap'>微信二维码</th>-->
            <th lay-data="{field:'btime',width:100}" class='text-left nowrap'>上班时间</th>
            <th lay-data="{field:'etime',width:100}" class='text-left nowrap'>下班时间</th>
            <th lay-data="{field:'addtime',width:200}" class='text-left nowrap'>添加时间</th>
            <th lay-data="{field:'edit',width:130,fixed: 'right'}" class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>

            <td class='text-left nowrap'>{$vo.id}</td>
            <td class='text-left nowrap'>{$vo.username}</td>
            <!--<td class='text-left nowrap'>{$vo.tel}</td>
            <td class='text-left nowrap'>{$vo.qq}</td>-->
            <td class='text-left nowrap'><a href="{$vo.url}" target="_blank">{$vo.url}</a></td>
            <!--<td class='text-left nowrap'>{$vo.wechat}</td>
            <td class='text-left nowrap'>{$vo.qr_code}</td>-->
            <td class='text-left nowrap'>{$vo.btime}</td>
            <td class='text-left nowrap'>{$vo.etime}</td>
            <td class='text-left nowrap'>
                {$vo.addtime|format_datetime}
            </td>
            <td class='text-left nowrap'>
                {if auth("edit_cs")}
                <a data-dbclick class="layui-btn layui-btn-xs" data-title="编辑菜单"
                   data-modal='{:url("users/edit_cs")}?id={$vo.id}'>编 辑</a>
                {/if}
                {if ($vo.status == 1) and auth("edit_cs_status")}
                <a class="layui-btn layui-btn-xs layui-btn-warm" data-csrf="{:systoken('edit_cs_status')}"
                   data-action="{:url('edit_cs_status',['status'=>2,'id'=>$vo.id])}" data-value="id#{$vo.id};status#2"
                   style='background:red;'>禁用</a>
                {elseif ($vo.status == 2) and auth("edit_cs_status") /}
                <a class="layui-btn layui-btn-xs layui-btn-warm" data-csrf="{:systoken('edit_cs_status')}"
                   data-action="{:url('edit_cs_status',['status'=>1,'id'=>$vo.id])}" data-value="id#{$vo.id};status#1"
                   style='background:green;'>启用</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <script>
        var table = layui.table;
        //转换静态表格
        var limit = Number('{$Think.get.limit}');
        if (limit == 0) limit = 20;
        table.init('tab', {
            cellMinWidth: 120,
            skin: 'line,row',
            size: 'lg',
            limit: limit
        });
    </script>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
